﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PssWork1.Model;

namespace PssWork1
{
    public partial class Question : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void tbnBC_Click(object sender, EventArgs e)
        {

            string bt = TextBox1.Text;
            string nr = TextBox2.Text;
            var sj = DateTime.Now;
            if (bt != "" && nr != "")
            {
                using (FAQDBEntities db = new FAQDBEntities())
                {

                    Topic topics = new Topic()
                    {
                        Title = bt,
                        Content = nr,
                        UpdateTime = sj,
                        IPAddress = "::1"

                    };
                    db.Topics.Add(topics);
                    db.SaveChanges();
                    Response.Redirect("Index.aspx");
                }
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "失败", "alter('请输入完整！')", true);
            }



        }

        protected void btnFH_Click(object sender, EventArgs e)
        {
            Response.Redirect("Index.aspx");

        }
    }
}